package nancal.mp

import com.zaxxer.hikari.HikariDataSource
import nancal.mp.db.mongo.mor
import nbcp.base.comm.BatchReader
import nbcp.base.utils.CodeUtil
import nbcp.base.utils.SpringUtil
import nbcp.myoql.db.mongo.query
import nbcp.myoql.db.mongo.updateById
import org.junit.jupiter.api.Test
import javax.sql.DataSource

class FixData2 : TestBase() {

    @Test
    fun ddd() {
        var reader = BatchReader.init(20, { skip, take ->
            mor.corp.corpUser.query().limit(skip, take).toList()
        });

        for (current in reader) {
            mor.corp.corpUser.updateById(current.id)
                .set { it.mysqlId to CodeUtil.getNumberValue() }
                .exec()
        }

    }

    val abc: String by lazy {
        ddd();
        return@lazy "abc"
    }

    @Test
    fun test3() {
        var d = SpringUtil.getBean<DataSource>() as HikariDataSource
        println(d.jdbcUrl)
        println(d.maximumPoolSize)

        println(d.password)
    }
}